public class Demo2 {
    public static int getLCA(int a, int b) {

        while(a != b) {
            if(a > b) {
                a  = a/2;
            }else {
                b = b/2;
            }
        }

        return a;
    }
    public static void main(String[] args) {
        getLCA(2,3);
    }
}
